<template>
  <div class="paperDialog">
    <el-form ref="dataForm">
      <div class="newTablev2">
        <el-tabs type="card" v-model="activeName">
          <el-tab-pane label=" 评审会信息 >" name="sfirst">
            <!-- :disabled="Tab1" -->
            <!-- 水利规划项目管理平台修改意见3-->
            <template v-slot:label>
              <i class="el-icon-s-help"></i>
              <!-- <img src="@/assets/img/l1.png"> el-icon-s-help-->
              <span> 评审会信息</span>
              <i class="el-icon-arrow-right" style="margin-left: 20%"></i>
            </template>
            <el-row :gutter="20" style="margin-left: 3%">
              <el-col :span="7"
                ><div>
                  <el-form-item
                    prop="reviewMeetingName"
                    label="评审会名称"
                    label-width="160px"
                    ><el-input
                      style="width: 100%;min-width: 180px;"
                      :maxlength="40"
                      size="small"
                      v-model="reviewmessage.reviewMeetingName"
                    ></el-input
                  ></el-form-item></div
              ></el-col>
              <el-col :span="7">
                <el-form-item
                  prop="reviewDate"
                  label="评审会时间:"
                  label-width="160px"
                >
                  <el-date-picker
                    v-model="reviewmessage.reviewDate"
                    style="width: 100%;min-width: 180px;"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择日期"
                  >
                  </el-date-picker>
                  <!-- <el-input
                              :maxlength="40"
                              size="small"
                              v-model="planbook.taskbookName"
                            ></el-input
                          > -->
                </el-form-item>
              </el-col>
              <el-col :span="7"
                ><div>
                  <el-form-item
                    prop="reviewOrganization"
                    label="组织单位"
                    label-width="160px"
                    ><el-input
                      style="width: 100%;min-width: 180px;"
                      :maxlength="40"
                      size="small"
                      v-model="reviewmessage.reviewOrganization"
                    ></el-input
                  ></el-form-item></div
              ></el-col>
            </el-row>
            <el-row :gutter="20" style="margin-left: 3%">
              <el-col :span="7"
                ><div>
                  <el-form-item
                    prop="projectName"
                    label="项目名称"
                    label-width="160px"
                    ><el-input
                      style="width: 100%;min-width: 180px;"
                      :maxlength="40"
                      size="small"
                      v-model="reviewmessage.projectName"
                    ></el-input
                  ></el-form-item></div
              ></el-col>
              <el-col :span="7"
                ><div>
                  <el-form-item
                    prop="projectPhase"
                    label="项目阶段"
                    label-width="160px"
                    ><el-input
                      style="width: 100%;min-width: 180px;"
                      :maxlength="40"
                      size="small"
                      v-model="reviewmessage.projectPhase"
                    ></el-input
                  ></el-form-item></div
              ></el-col>
              <el-col :span="7"
                ><div>
                  <el-form-item
                    prop="reportOrganization"
                    label="编制单位"
                    label-width="160px"
                    ><el-input
                      style="width: 100%;min-width: 180px;"
                      :maxlength="40"
                      size="small"
                      v-model="reviewmessage.reportOrganization"
                    ></el-input
                  ></el-form-item></div
              ></el-col>
            </el-row>
            <!-- <el-row :gutter="20" style="margin-left: 3%">
              <el-col :span="7"
                ><div>
                  <el-form-item
                    prop="projectName"
                    label="组织单位"
                    label-width="160px"
                    ><el-input
                      style="width: 80%"
                      :maxlength="40"
                      size="small"
                      v-model="reviewmessage.projectName"
                    ></el-input
                  ></el-form-item></div
              ></el-col>
            </el-row>            -->
             <div>
              <el-button type="primary" @click="saveone" style="margin-top: 25%"
                >保存</el-button
              >
            </div>
          </el-tab-pane>
          <el-tab-pane label="专家抽选 >" name="ssecond">
            <!-- :disabled="Tab1" -->
            <!-- 水利规划项目管理平台修改意见3-->
            <template v-slot:label>
              <i class="el-icon-s-help"></i>
              <!-- <img src="@/assets/img/l1.png"> el-icon-s-help-->
              <span> 专家抽选</span>
              <i class="el-icon-arrow-right" style="margin-left: 20%"></i>
            </template>
            <div>
              <div style="margin-left: 5%; width: 60%">
                <h3 style="text-align: left">抽选条件</h3>
                <div style="border: gray solid 1px;text-align:left">
                  <div style="margin: 2%">
                    <el-row :gutter="20">
                      <el-col :span="8"
                        ><div>
                          选取专家数量
                          <el-input
                            style="width: 60%; margin-left: 1%"
                            :maxlength="40"
                            size="small"
                            v-model.number="expertselect.selectedExpertsCount"
                          ></el-input></div
                      ></el-col>
                      <el-col :span="11"
                        ><div>
                          <!-- <el-select style='width:70%;margin-left: 1%;'v-model="expertselect.expertiseList" multiple placeholder="请选择">
    <el-option
      v-for="item in options"
      :key="item.value"
      :label="item.label" 
      :value="item.value">
    </el-option>  </el-select> -->

                          <!-- <el-cascader
                            style="width: 9vw"
                            v-model="expertselect.expertiseList"
                            :options="majoroptions"
                            :props="props"
                            collapse-tags
                            @change="selectchange"
                          ></el-cascader> -->
                          <el-button size="small" @click="getnumber" type="primary">确定</el-button>
                          </div
                      ></el-col>
                    </el-row>
                        <el-row :gutter="20">
                          <el-col :span="24"
                        > <el-table
                      :data="expertselect.drawConditions"
                      stripe
                      border
                      fit
                      style="margin-top: 3%;"
                      highlight-current-row
                      ref="expertTable"
                    >
                      <!-- <el-table-column type="selection" width="55" /> -->
                      <el-table-column
                        type="index"
                        align="center"
                        label="序号"
                        width="120"
                      />
                      <el-table-column prop="expertise1" align="center" label="专业一" min-width="150">
          <template slot-scope="scope">
            <!-- <el-select v-model="scope.row.expertise1" placeholder="请选择专业一" clearable size="small">
              <el-option v-for="option in expertiseOptions" :key="option" :label="option" :value="option"></el-option>
            </el-select> -->
            <el-cascader
                            style="width: 9vw"
                            v-model="scope.row.expertise1"
                            :options="majoroptions"
                            placeholder="请选择专业一"
                            collapse-tags
                            @change="selectchange"
                          ></el-cascader> 
          </template>
        </el-table-column>
        <el-table-column prop="expertise2" align="center" label="专业二" min-width="150">
          <template slot-scope="scope">
            <!-- <el-select v-model="scope.row.expertise2" placeholder="请选择专业二" clearable size="small">
              <el-option v-for="option in expertiseOptions" :key="option" :label="option" :value="option"></el-option>
            </el-select> -->
            <el-cascader
                            style="width: 9vw"
                            v-model="scope.row.expertise2"
                            :options="majoroptions1"
                            collapse-tags
                            placeholder="请选择专业二"
                            @change="selectchange"
                          ></el-cascader> 
          </template>
        </el-table-column>
                      <!-- <el-table-column
                        prop="workUnit"
                        align="center"
                        label="单位"
                      />
                      <el-table-column label="操作" align="center" width="180">
                        <template slot-scope="scope">
                          <el-button
                            type="text"
                            size="small"
                            @click="editExpert(scope.row)"
                            >编辑</el-button
                          >
                          <el-button
                            type="text"
                            size="small"
                            @click="delExpert(scope.row.expertId)"
                            >删除</el-button
                          >
                        </template>
                      </el-table-column> -->
                    </el-table></el-col
                      >
                      <!-- <el-col :span="12"
                        ><div style="margin-top: 7%">
                          <el-checkbox style="font-size: 0.9vw;" v-model="expertselect.isAcademic">是否成为院士</el-checkbox>
                          
                          
                        </div>
                        <div style="margin-top: 7%">
                          <el-checkbox style="font-size: 0.9vw;" v-model="expertselect.isSubsidy">是否为享受国务院政府特殊津贴的专家</el-checkbox>

                          
                        </div>
                        <div style="margin-top: 7%">
                          <el-checkbox style="font-size: 0.9vw;" v-model="expertselect.isDesignMaster">是否为全国或省级工程勘察设计大师（水利）</el-checkbox>

                         
                        </div>
                        <div style="margin-top: 7%">
                          <el-checkbox style="font-size: 0.9vw;" v-model="expertselect.isSpecial">是否为人才紧缺的特殊专业、特殊领域技术人才</el-checkbox>

                        
                        </div>
                        </el-col
                      > -->
                    </el-row>
                    <!-- <el-row :gutter="20">
                      <el-col :span="11"
                        ><div style="margin-top: 7%">
                          是否成为院士
                          <el-radio-group v-model="expertselect.isAcademic">
                            <el-radio :label="true">是</el-radio>
                            <el-radio :label="false">否</el-radio>
                          </el-radio-group>
                        </div></el-col
                      >
                      <el-col :span="11"
                        ><div style="margin-top: 7%">
                          是否为享受国务院政府特殊津贴的专家
                          <el-radio-group v-model="expertselect.isSubsidy">
                            <el-radio :label="true">是</el-radio>
                            <el-radio :label="false">否</el-radio>
                          </el-radio-group>
                        </div></el-col
                      >
                    </el-row>
                    <el-row :gutter="20">
                      <el-col :span="11"
                        ><div style="margin-top: 7%">
                          是否为全国或省级工程勘察设计大师（水利）<el-radio-group
                            v-model="expertselect.isDesignMaster"
                          >
                            <el-radio :label="true">是</el-radio>
                            <el-radio :label="false">否</el-radio>
                          </el-radio-group>
                        </div></el-col
                      >
                      <el-col :span="11"
                        ><div style="margin-top: 7%">
                          是否为人才紧缺的特殊专业、特殊领域技术人才
                          <el-radio-group v-model="expertselect.isSpecial">
                            <el-radio :label="true">是</el-radio>
                            <el-radio :label="false">否</el-radio>
                          </el-radio-group>
                        </div></el-col
                      >
                    </el-row> -->
                    <div style="margin-top: 2%">
                      <el-button
                        type="primary"
                        @click="backselect"
                        size="medium"
                        >条件重置</el-button
                      >
                      <el-button
                        type="primary"
                        @click="selectepxert"
                        size="medium"
                        >开始筛选</el-button
                      >
                    </div>
                  </div>
                </div>
              </div>

              <div style="margin-left: 5%; width: 70%">
                <h3 style="text-align: left">抽选结果</h3>
                <div style="border: gray solid 1px;text-align:left">
                  <div style="margin: 2%">
                    <el-table
                      :data="selectresult"
                      stripe
                      border
                      fit
                      highlight-current-row
                      ref="expertTable"
                      @selection-change="handleSelectionChange"
                    >
                      <el-table-column type="selection" width="55" />
                      <el-table-column
                        type="index"
                        align="center"
                        label="序号"
                        width="50"
                      />
                      <el-table-column
                        prop="name"
                        align="center"
                        label="专家姓名"
                        width="100"
                      />
                      <el-table-column
                        prop="title"
                        align="center"
                        label="职称"
                        width="100"
                      />
                      <el-table-column
                        prop="expertise"
                        align="center"
                        label="专业"
                        width="200"
                      >
                      </el-table-column>
                      <el-table-column
                        prop="workUnit"
                        align="center"
                        label="单位"
                      />
                      <!-- <el-table-column
                        prop="expertCategory"
                        align="center"
                        label="专家类别"
                      />
                      <el-table-column
                        prop="changeCounts"
                        align="center"
                        label="变更次数"
                      /> -->

                      
                      <el-table-column label="操作" align="center" width="180">
                        <template slot-scope="scope">
                          <el-button
                            type="text"
                            size="small"
                            @click="editExpert(scope.row,scope.$index)"
                            >编辑</el-button
                          >
                          <el-button
                            type="text"
                            size="small"
                            @click="delExpert(scope.row.expertId,scope.$index)"
                            >重抽</el-button
                          >
                        </template>
                      </el-table-column>
                    </el-table>
                    <div style="margin-top: 2%">
                      <el-button type="primary" @click="addresult1" size="medium"
                        >增加</el-button
                      >
                      <el-button type="primary" @click="downresult" size="medium"
                        >打印</el-button
                      >
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <el-button
              type="primary"
              @click="savetwo"
              style="margin-top: 3%; margin-bottom: 3%"
              >保存</el-button
            >
          </el-tab-pane>
          <!-- <el-tab-pane label=" 项目后评价 >" name="sthird">
            <template v-slot:label>
              <i class="el-icon-s-help"></i>
              <span> 项目后评价</span>
              <i class="el-icon-arrow-right" style="margin-left: 20%"></i>
            </template>
            <div>
              <div style="margin-left: 5%; width: 70%">
                <h3>当前涉及项目变更次数 {{ reviewmessage.changeCount }} 次</h3>
              </div>

              <div style="margin-left: 5%; width: 70%">
                <div style="margin: 2%">
                  <el-table
                    :data="tabledata"
                    stripe
                    border
                    fit
                    highlight-current-row
                    ref="expertTable"
                    @selection-change="handleSelectionChange"
                  >
                    <el-table-column type="selection" width="55" />
                    <el-table-column type="index" label="序号" width="70" />
                    <el-table-column prop="changeDate" label="变更登记时间">
                    </el-table-column>
                    <el-table-column prop="changeContent" label="变更内容" />
                    <el-table-column prop="expertises" label="变更专业">
                    </el-table-column>

                    <el-table-column prop="experts" label="涉及专家" />
                    <el-table-column label="操作" width="100">
                      <template slot-scope="scope">
                        <el-button
                          type="text"
                          size="small"
                          @click="deleteExpert(scope.row.id)"
                          >删除</el-button
                        >
                      </template>
                    </el-table-column>
                  </el-table>
                  <el-button
                    style="margin-top: 2%"
                    type="primary"
                    @click="addrow"
                    icon="el-icon-circle-plus"
                    size="mini"
                    circle
                  ></el-button>
                  <div style="margin-top: 2%; text-align: left">
                    <div>
                      评审结论
                      <el-select v-model="reviewmessage.reviewConclusion" placeholder="请选择">
                        <el-option
                          v-for="item in options1"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value"
                        >
                        </el-option>
                      </el-select>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <el-button type="primary" @click="savethree" style="margin-top: 6%">保存</el-button>
          </el-tab-pane> -->
        </el-tabs>
      </div>
    </el-form>
    <el-dialog :visible.sync="addvisiable" title="新增变更信息" width="40%">
      <el-form :model="addForm" label-width="120px" class="aligned-form">
        <el-form-item label="变更时间">
          <el-date-picker
            style="width: 90%"
            v-model="addForm.changeDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择日期"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="变更内容">
          <el-input
            type="textarea"
            :rows="3"
            style="width: 90%"
            v-model="addForm.changeContent"
          />
        </el-form-item>
        <el-form-item label="变更专业">
          <el-cascader
            style="width: 90%"
            v-model="addForm.expertises"
            :options="optionchange"
            :props="props"
            collapse-tags
            @change="selectchange1"
          ></el-cascader>
          <!-- </el-option> -->
          <!-- </el-select> -->
          <!-- <el-button @click="selectall" style="margin-left: 2%"
            >选择所有</el-button
          > -->
        </el-form-item>
        <el-form-item label="涉及专家">
          <el-input style="width: 90%" v-model="addForm.experts" />
        </el-form-item>
      </el-form>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="addvisiable = false">取消</el-button>
          <el-button type="primary" @click="saveAdd">保存</el-button>
        </span>
      </template>
    </el-dialog>

    <el-dialog :visible.sync="editvisiable1" title="编辑抽选结果" width="50%">
      <el-form :model="addForm3" label-width="70px" class="aligned-form">
        <el-row :gutter="20">
          <el-col :span="8"
            ><div>
              <el-form-item label="姓名">
                <el-input style="width: 90%" v-model="addForm3.name" />
              </el-form-item></div
          ></el-col>
          <el-col :span="8"
            ><div>
              <el-form-item label="变更专业" label-width="90px" >
          <!-- <el-select style="width: 40%;" v-model="addForm.expertises" multiple placeholder="请选择"> -->
          <el-cascader
            style="width: 100%"
            v-model="addForm3.major"
            :options="majoroptions"
            collapse-tags
            @change="selectchange1"
          ></el-cascader>
          <!-- </el-option> -->
          <!-- </el-select> -->
          <!-- <el-button @click="selectall" style="margin-left: 2%"
            >选择所有</el-button
          > -->
        </el-form-item></div
          ></el-col>
          <!-- <el-col :span="8"><div>2</div></el-col> -->
          <el-col :span="4"><div>                      <el-button
                        type="primary"
                        @click="searchchangeresult"
                        size="medium"
                        >搜索</el-button
                      ></div></el-col>
          <el-col :span="4"><div><el-button
                        type="primary"
                        @click="resetchangeresult"
                        size="medium"
                        >重置</el-button
                      ></div></el-col>
        </el-row>
        <el-table
                      :data="selectresult1"
                      stripe
                      border
                      max-height="450"
                      fit
                      highlight-current-row
                      ref="expertTable"
                      @selection-change="handleSelectionChange1"
                    >
                      <el-table-column type="selection" width="55" />
                      <el-table-column
                        type="index"
                        align="center"
                        label="序号"
                        width="50"
                      />
                      <el-table-column
                        prop="name"
                        align="center"
                        label="专家姓名"
                        width="100"
                      />
                      <el-table-column
                        prop="title"
                        align="center"
                        label="职称"
                        width="100"
                      />
                      <el-table-column
                        prop="expertise"
                        align="center"
                        label="专业"
                        width="120"
                      />
                      <el-table-column
                        prop="majorPosition"
                        align="center"
                        label="专业位置"
                        width="120"
                      >
                      <!-- majorPosition -->
                      </el-table-column>
                      <el-table-column
                        prop="workUnit"
                        align="center"
                        label="单位"
                      />
                    </el-table>
        <!-- <el-form-item label="变更时间">
          <el-input style="width:90%" v-model="addForm1.time" />
        </el-form-item>
        <el-form-item label="变更内容">
          <el-input style="width:90%" v-model="addForm1.content" />
        </el-form-item>
        <el-form-item label="变更专业">
          <el-select v-model="addForm1.major" multiple  placeholder="请选择">
    <el-option
      v-for="item in options1"
      :key="item.value"
      :label="item.label"
      :value="item.value">
    </el-option>
  </el-select>
          <el-button @click="selectall" style="margin-left: 2%;">选择所有</el-button>
        </el-form-item>
        <el-form-item label="涉及专家">
          <el-input style="width:90%" v-model="addForm1.expert" />
        </el-form-item> -->
      </el-form>
      <template #footer>
        <span class="dialog-footer">
          <!-- <el-button @click="editvisiable1 = false">取消</el-button> -->
          <el-button type="primary" @click="saveAdd2">确定</el-button>
        </span>
      </template>
    </el-dialog>
    <el-dialog :visible.sync="addresultvisible" title="新增抽选结果" width="40%">
      <el-form :model="addForm1" label-width="70px" class="aligned-form">
        <el-row :gutter="20">
                          <el-col :span="24"
                        > <el-table
                      :data="addForm1.drawConditions"
                      stripe
                      border
                      fit
                      style="margin-top: 3%;"
                      highlight-current-row
                      ref="expertTable"
                    >
                      <!-- <el-table-column type="selection" width="55" /> -->
                      <el-table-column
                        type="index"
                        align="center"
                        label="序号"
                        width="120"
                      />
                      <el-table-column prop="expertise1" align="center" label="专业一" min-width="150">
          <template slot-scope="scope">
            <!-- <el-select v-model="scope.row.expertise1" placeholder="请选择专业一" clearable size="small">
              <el-option v-for="option in expertiseOptions" :key="option" :label="option" :value="option"></el-option>
            </el-select> -->
            <el-cascader
                            style="width: 9vw"
                            v-model="scope.row.expertise1"
                            :options="majoroptions"
                            placeholder="请选择专业一"
                            collapse-tags
                            @change="selectchange"
                          ></el-cascader> 
          </template>
        </el-table-column>
        <el-table-column prop="expertise2" align="center" label="专业二" min-width="150">
          <template slot-scope="scope">
            <!-- <el-select v-model="scope.row.expertise2" placeholder="请选择专业二" clearable size="small">
              <el-option v-for="option in expertiseOptions" :key="option" :label="option" :value="option"></el-option>
            </el-select> -->
            <el-cascader
                            style="width: 9vw"
                            v-model="scope.row.expertise2"
                            :options="majoroptions1"
                            collapse-tags
                            placeholder="请选择专业二"
                            @change="selectchange"
                          ></el-cascader> 
          </template>
        </el-table-column>
                      <!-- <el-table-column
                        prop="workUnit"
                        align="center"
                        label="单位"
                      />
                      <el-table-column label="操作" align="center" width="180">
                        <template slot-scope="scope">
                          <el-button
                            type="text"
                            size="small"
                            @click="editExpert(scope.row)"
                            >编辑</el-button
                          >
                          <el-button
                            type="text"
                            size="small"
                            @click="delExpert(scope.row.expertId)"
                            >删除</el-button
                          >
                        </template>
                      </el-table-column> -->
                    </el-table></el-col
                      >
                      <!-- <el-col :span="12"
                        ><div style="margin-top: 4%;text-align: left">
                          <el-checkbox v-model="addForm1.isAcademic">是否成为院士</el-checkbox>

                          
                        </div>
                        <div style="margin-top: 4%;text-align: left">
                          
                          <el-checkbox v-model="addForm1.isSubsidy">是否为享受国务院政府特殊津贴的专家</el-checkbox>

                          
                        </div>
                        <div style="margin-top: 4%;text-align: left">
                          <el-checkbox v-model="addForm1.isDesignMaster">是否为全国或省级工程勘察设计大师（水利）</el-checkbox>

                          
                        </div>
                        <div style="margin-top: 4%;text-align: left">
                          <el-checkbox v-model="addForm1.isSpecial">是否为人才紧缺的特殊专业、特殊领域技术人才</el-checkbox>

                          
                          
                        </div>
                        </el-col
                      > -->
                    </el-row>
        <!-- <el-form-item label="变更时间">
          <el-input style="width:90%" v-model="addForm1.time" />
        </el-form-item>
        <el-form-item label="变更内容">
          <el-input style="width:90%" v-model="addForm1.content" />
        </el-form-item>
        <el-form-item label="变更专业">
          <el-select v-model="addForm1.major" multiple  placeholder="请选择">
    <el-option
      v-for="item in options1"
      :key="item.value"
      :label="item.label"
      :value="item.value">
    </el-option>
  </el-select>
          <el-button @click="selectall" style="margin-left: 2%;">选择所有</el-button>
        </el-form-item>
        <el-form-item label="涉及专家">
          <el-input style="width:90%" v-model="addForm1.expert" />
        </el-form-item> -->
      </el-form>
      <template #footer>
        <span class="dialog-footer">
          <!-- <el-button @click="addresultvisible = false">取消</el-button> -->
          <el-button type="primary" @click="saveAdd4">确定</el-button>
        </span>
      </template>
    </el-dialog>
    <el-dialog :visible.sync="editvisiable2" title="重新抽选" width="40%">
      <el-form :model="addForm2" label-width="70px" class="aligned-form">
        <el-row :gutter="20">
                          <el-col :span="24"
                        > <el-table
                      :data="addForm2.drawConditions"
                      stripe
                      border
                      fit
                      style="margin-top: 3%;"
                      highlight-current-row
                      ref="expertTable"
                    >
                      <!-- <el-table-column type="selection" width="55" /> -->
                      <el-table-column
                        type="index"
                        align="center"
                        label="序号"
                        width="120"
                      />
                      <el-table-column prop="expertise1" align="center" label="专业一" min-width="150">
          <template slot-scope="scope">
            <!-- <el-select v-model="scope.row.expertise1" placeholder="请选择专业一" clearable size="small">
              <el-option v-for="option in expertiseOptions" :key="option" :label="option" :value="option"></el-option>
            </el-select> -->
            <el-cascader
                            style="width: 9vw"
                            v-model="scope.row.expertise1"
                            :options="majoroptions"
                            placeholder="请选择专业一"
                            collapse-tags
                            @change="selectchange"
                          ></el-cascader> 
          </template>
        </el-table-column>
        <el-table-column prop="expertise2" align="center" label="专业二" min-width="150">
          <template slot-scope="scope">
            <!-- <el-select v-model="scope.row.expertise2" placeholder="请选择专业二" clearable size="small">
              <el-option v-for="option in expertiseOptions" :key="option" :label="option" :value="option"></el-option>
            </el-select> -->
            <el-cascader
                            style="width: 9vw"
                            v-model="scope.row.expertise2"
                            :options="majoroptions1"
                            collapse-tags
                            placeholder="请选择专业二"
                            @change="selectchange"
                          ></el-cascader> 
          </template>
        </el-table-column>
                      <!-- <el-table-column
                        prop="workUnit"
                        align="center"
                        label="单位"
                      />
                      <el-table-column label="操作" align="center" width="180">
                        <template slot-scope="scope">
                          <el-button
                            type="text"
                            size="small"
                            @click="editExpert(scope.row)"
                            >编辑</el-button
                          >
                          <el-button
                            type="text"
                            size="small"
                            @click="delExpert(scope.row.expertId)"
                            >删除</el-button
                          >
                        </template>
                      </el-table-column> -->
                    </el-table></el-col
                      >
                      <!-- <el-col :span="12"
                        ><div style="margin-top: 4%;text-align: left">
                          <el-checkbox v-model="addForm2.isAcademic">是否成为院士</el-checkbox>

                     
                        </div>
                        <div style="margin-top: 4%;text-align: left">
                          <el-checkbox v-model="addForm2.isSubsidy">是否为享受国务院政府特殊津贴的专家</el-checkbox>

                 
                        </div>
                        <div style="margin-top: 4%;text-align: left">
                          <el-checkbox v-model="addForm2.isDesignMaster">是否为全国或省级工程勘察设计大师（水利）</el-checkbox>

                        </div>
                        <div style="margin-top: 4%;text-align: left">
                          
                          <el-checkbox v-model="addForm2.isSpecial">是否为人才紧缺的特殊专业、特殊领域技术人才</el-checkbox>

                  
                        </div>
                        </el-col
                      > -->
                    </el-row>
        <!-- <el-form-item label="变更时间">
          <el-input style="width:90%" v-model="addForm1.time" />
        </el-form-item>
        <el-form-item label="变更内容">
          <el-input style="width:90%" v-model="addForm1.content" />
        </el-form-item>
        <el-form-item label="变更专业">
          <el-select v-model="addForm1.major" multiple  placeholder="请选择">
    <el-option
      v-for="item in options1"
      :key="item.value"
      :label="item.label"
      :value="item.value">
    </el-option>
  </el-select>
          <el-button @click="selectall" style="margin-left: 2%;">选择所有</el-button>
        </el-form-item>
        <el-form-item label="涉及专家">
          <el-input style="width:90%" v-model="addForm1.expert" />
        </el-form-item> -->
      </el-form>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="editvisiable2 = false">取消</el-button>
          <el-button type="primary" @click="saveAdd3">确定</el-button>
        </span>
      </template>
    </el-dialog>
  </div>
</template>
  <script>
import {
  savereview,
  getexpert,
  getexpert1,
  saveexpert,
  addchangeexpert,
  deleteexpertchange,
  searchbynamemarjor,
  downinfo
  } from "@/api/table";
import {downpdf} from "@/api/new";
export default {
  data() {
    return {
      role: '',
      addForm3:{name:'',major:[]},
      radio: "是",
      repeatid: '',
      repeatindex: '',
      editindex:'',
      selectdata: [],
      editresult:[],
      addresult:[],
      editvisiable2: false,
      addresultvisible:false,
      addvisiable: false,
      editvisiable1: false,
      id: "",
      selectresult: [],
      changedetail: {
        id: "",
        reviewId: "",
        changeDate: "",
        changeContent: "",
        expertises: ["", ""],
        experts: "",
        changeCounts: 0,
        expertInfoVOS: [
          {
            expertId: "",
            name: "",
          },
        ],
      },
      reviewmessage: {
        reviewMeetingName: '',
    reviewDate: '',
    reviewOrganization:'',
    reportOrganization: '',
    dept: '',
    projectName: '',
    projectPhase: '',
    selectedExpertsCount: 0,
    isLottery: false,
    expertiseList: '',
    isAcademic: true,
    isSubsidy: false,
    isDesignMaster: false,
    isSpecial: false,
    changeCount: 0,
    reviewConclusion: '',
      },
      expertselect: {
        selectedExpertsCount: '',
        drawConditions: [],
        isAcademic: false,
        isSubsidy: false,
        isDesignMaster: false,
        isSpecial: false,
      },
      addForm2: {
        selectedExpertsCount: 1,
        drawConditions: [{
            expertise1: "",
            expertise2: ""
        }],
        isAcademic: false,
        isSubsidy: false,
        isDesignMaster: false,
        isSpecial: false,
      },
      props: { multiple: true },
      num: 2,
      addForm: {},
      addForm1: {
        selectedExpertsCount: 1,
        drawConditions: [{
            expertise1: "",
            expertise2: ""
        }],
        isAcademic: false,
        isSubsidy: false,
        isDesignMaster: false,
        isSpecial: false,
      },
      majoroptions: [
        // {
        //   value: "无",
        //   label: "无",
        // },
        // {
        //   value: "督查稽察",
        //   label: "督查稽察",
        //   children: [
        //     {
        //       value: "建设管理",
        //       label: "建设管理",
        //     },
        //     {
        //       value: "计划管理",
        //       label: "计划管理",
        //     },
        //     {
        //       value: "质量管理",
        //       label: "质量管理",
        //     },
        //     {
        //       value: "安全管理",
        //       label: "安全管理",
        //     },
        //   ],
        // },
        {
          value: "水利规划",
          label: "水利规划",
        },
        {
          value: "水文泥沙",
          label: "水文泥沙",
        },
        {
          value: "水资源",
          label: "水资源",
        },
        {
          value: "节水评价",
          label: "节水评价",
        },
        {
          value: "水土保持",
          label: "水土保持",
        },
        {
          value: "农田水利",
          label: "农田水利",
        },
        {
          value: "城乡供水",
          label: "城乡供水",
        },
        {
          value: "水工结构",
          label: "水工结构",
        },
        {
          value: "河道治理",
          label: "河道治理",
        },
        {
          value: "工程地质与工程测绘",
          label: "工程地质与工程测绘",
        },
        {
          value: "水旱灾害防御抢险",
          label: "水旱灾害防御抢险",
        },
        {
          value: "工程造价与经济评价",
          label: "工程造价与经济评价",
        },
        {
          value: "征地移民",
          label: "征地移民",
        },
        {
          value: "电气机电与金属结构",
          label: "电气机电与金属结构",
        },
        {
          value: "水利政策法规",
          label: "水利政策法规",
        },
        {
          value: "施工组织与管理",
          label: "施工组织与管理",
        },
        {
          value: "水利信息化",
          label: "水利信息化",
        },
        {
          value: "工程管理",
          label: "工程管理",
        },
        {
          value: "节能评价",
          label: "节能评价",
        },
        {
          value: "资金管理",
          label: "资金管理",
        },
        {
          value: "水力发电",
          label: "水力发电",
        },
        {
          value: "劳动安全与工业卫生",
          label: "劳动安全与工业卫生",
        },
        {
          value: "环境影响评价",
          label: "环境影响评价",
        },
        {
          value: "社会稳定分析",
          label: "社会稳定分析",
        },
        {
          value: "质量检测",
          label: "质量检测",
        },
        {
          value: "水文化",
          label: "水文化",
        },
        {
          value: "劳动安全与工业卫生(安全生产)",
          label: "劳动安全与工业卫生(安全生产)",
        },
        {
          value: "质量管理",
          label: "质量管理",
        },
        {
          value: "建设管理",
          label: "建设管理",
        },
        {
          value: "计划管理",
          label: "计划管理",
        },
      ],
      majoroptions1: [
        {
          value: '无',
          label: "无",
        },
        
        // {
        //   value: "督查稽察",
        //   label: "督查稽察",
        //   children: [
        //     {
        //       value: "建设管理",
        //       label: "建设管理",
        //     },
        //     {
        //       value: "计划管理",
        //       label: "计划管理",
        //     },
        //     {
        //       value: "质量管理",
        //       label: "质量管理",
        //     },
        //     {
        //       value: "安全管理",
        //       label: "安全管理",
        //     },
        //   ],
        // },
        {
          value: "水利规划",
          label: "水利规划",
        },
        {
          value: "水文泥沙",
          label: "水文泥沙",
        },
        {
          value: "水资源",
          label: "水资源",
        },
        {
          value: "节水评价",
          label: "节水评价",
        },
        {
          value: "水土保持",
          label: "水土保持",
        },
        {
          value: "农田水利",
          label: "农田水利",
        },
        {
          value: "城乡供水",
          label: "城乡供水",
        },
        {
          value: "水工结构",
          label: "水工结构",
        },
        {
          value: "河道治理",
          label: "河道治理",
        },
        {
          value: "工程地质与工程测绘",
          label: "工程地质与工程测绘",
        },
        {
          value: "水旱灾害防御抢险",
          label: "水旱灾害防御抢险",
        },
        {
          value: "工程造价与经济评价",
          label: "工程造价与经济评价",
        },
        {
          value: "征地移民",
          label: "征地移民",
        },
        {
          value: "电气机电与金属结构",
          label: "电气机电与金属结构",
        },
        {
          value: "水利政策法规",
          label: "水利政策法规",
        },
        {
          value: "施工组织与管理",
          label: "施工组织与管理",
        },
        {
          value: "水利信息化",
          label: "水利信息化",
        },
        {
          value: "工程管理",
          label: "工程管理",
        },
        {
          value: "节能评价",
          label: "节能评价",
        },
        {
          value: "资金管理",
          label: "资金管理",
        },
        {
          value: "水力发电",
          label: "水力发电",
        },
        {
          value: "劳动安全与工业卫生",
          label: "劳动安全与工业卫生",
        },
        {
          value: "环境影响评价",
          label: "环境影响评价",
        },
        {
          value: "社会稳定分析",
          label: "社会稳定分析",
        },
        {
          value: "质量检测",
          label: "质量检测",
        },
        {
          value: "水文化",
          label: "水文化",
        },
        {
          value: "劳动安全与工业卫生(安全生产)",
          label: "劳动安全与工业卫生(安全生产)",
        },
        {
          value: "质量管理",
          label: "质量管理",
        },
        {
          value: "建设管理",
          label: "建设管理",
        },
        {
          value: "计划管理",
          label: "计划管理",
        },
      ],
      selectresult1:[],
      currentresult:{},
      options1: [
        {
          value: "审评通过",
          label: "审评通过",
        },
        {
          value: "进一步修改完善",
          label: "进一步修改完善",
        },
        {
          value: "不予通过",
          label: "不予通过",
        },
      ],
      options: [
        {
          value: "选项1",
          label: "黄金糕",
        },
        {
          value: "选项2",
          label: "双皮奶",
        },
        {
          value: "选项3",
          label: "蚵仔煎",
        },
        {
          value: "选项4",
          label: "龙须面",
        },
        {
          value: "选项5",
          label: "北京烤鸭",
        },
      ],
      options2: [],
      optionchange: [],
      value1: [],
      multipleSelection: [],
      activeName: "sfirst",
      tabledata: [],
    };
  },

    mounted() {
    this.role = sessionStorage.getItem('role')
    console.log(role);
    //   this.restaurants = this.loadAll();
  },
    methods: {
      downresult() {
        console.log(this.selectresult);
  //       downinfo(this.selectresult).then((res) => {
  //         console.log(res);
  //         const blob = new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })
  // const url = URL.createObjectURL(blob)
  // const a = document.createElement('a')
  // a.href = url
  // a.download = '评审会议记录.xlsx'
  // document.body.appendChild(a)
  // a.click()
  // document.body.removeChild(a)
  // URL.revokeObjectURL(url)
        //       })
        downpdf(this.id, this.selectresult).then((res) => {
          console.log(res);
          const blob = new Blob([res], { type: 'application/pdf' })
  const url = URL.createObjectURL(blob)
  const a = document.createElement('a')
  a.href = url
  a.download = '抽选结果.pdf'
  document.body.appendChild(a)
  a.click()
  document.body.removeChild(a)
  URL.revokeObjectURL(url)
        })
      },
    selectchange() {
      this.optionchange = [
        {
          label: "全部",
          value: "全部",
        },
      ];
      const a = []
      for (let i = 0; i < this.selectresult.length; i++) {
  console.log(this.selectresult[i].expertise);
  a.push(this.selectresult[i].expertise.split(','))
  // b.push(this.selectresult[i].name)
      }
console.log(123);
      for (let i = 0; i < a.length; i++) {
        const element = {
          label: a[i],
          value: a[i],
        };
        console.log(456);
        this.optionchange.push(element);
      }
    },
    selectchange1() {
      // this.optionchange = []
      console.log(this.addForm);
      // expertise
       
      for (let i = 0; i < this.addForm.expertises.length; i++) {
        this.addForm.expertises[i] = this.addForm.expertises[i].join("/");
      }
      this.b = []
      console.log(this.addForm.expertises);
      for (let i = 0; i < this.addForm.expertises.length; i++) {
        if (this.addForm.expertises[i] == "全部") {
          console.log('选择了全部');
          const a = this.selectresult
  .filter(data => data.name) // 筛选出有name属性的对象
            .map(data => data.name);   // 提取name属性值形成新数组
  console.log(a);
          this.addForm.experts = a.join(",");
          break;
        } else {
                  for (let j = 0; j < this.selectresult.length; j++) {
          console.log(this.addForm.expertises[i],this.selectresult[j].expertise.includes(this.addForm.expertises[i]));
          if (this.addForm.expertises[i],this.selectresult[j].expertise.includes(this.addForm.expertises[i])) {
            this.b.push(this.selectresult[j].name)
          }
        }
        console.log(this.b);
        const uniqueb = [...new Set(this.b)];
        this.addForm.experts = uniqueb.join(",");
        }

      }
      // console.log(this.addForm.expertises);
      // console.log(this.selectresult);
      // const a = [];
      const b = [];
      for (let i = 0; i < this.selectresult.length; i++) {
        console.log(this.selectresult[i].expertise);
        const element = this.selectresult[i].expertise;
        for (let j = 0; j < this.addForm.expertises.length; j++) {
          console.log(this.addForm.expertises[j]);
          const element1 = this.addForm.expertises[j];
          if (this.selectresult[i].expertise.includes(element1)) {
            // a.push(this.selectresult[i].name);
            const element2 = {
              expertId: this.selectresult[i].expertId,
              name: this.selectresult[i].name,
            };
            b.push(element2);
          }
        }
        console.log(element);
        // this.addForm.experts = a.join(",");
        this.addForm.expertInfoVOS = b;
      }
    },
    backselect() {
      this.expertselect = {
        selectedExpertsCount: '',
        drawConditions: [],
        isAcademic: false,
        isSubsidy: false,
        isDesignMaster: false,
        isSpecial: false,
      };
    },
    selectepxert() {
      console.log(this.expertselect);
      if (this.expertselect.drawConditions.length == 0) {
        this.$message.warning("请选择专业");
        return;
      }
      if (this.expertselect.selectedExpertsCount == 0 ||  this.expertselect.selectedExpertsCount == '') {
        this.$message.warning("抽选人数未填写");
        return;
      }
      const a = JSON.stringify(this.expertselect)
      const params = JSON.parse(a)
for (let i = 0; i < params.drawConditions.length; i++) {
  // const element = array[i];

  params.drawConditions[i].expertise1 = params.drawConditions[i].expertise1.join('/')
  params.drawConditions[i].expertise2 = params.drawConditions[i].expertise2.join('/')
  if (params.drawConditions[i].expertise1 == params.drawConditions[i].expertise2) {
    this.$message.warning(`第${i + 1}组序号的专业重复`);
    return
  }
  if (params.drawConditions[i].expertise1 == '无') {
    params.drawConditions[i].expertise1  = null
  } else if (params.drawConditions[i].expertise2 == '无') {
    params.drawConditions[i].expertise2  = null
    
  }
  console.log(params.drawConditions[i].expertise1);
  console.log(params.drawConditions[i].expertise2);
  
}
const b = params.drawConditions
      getexpert1(this.id, b)
        .then((res) => {
          console.log(res);
          if (res.code == 200) {
            this.$message.success("获取成功！");
            console.log(res.data);
            this.selectresult = res.data;
          }
        })
        .catch((err) => {
          console.error(err);
        });
    },
    saveAdd2(){
      console.log(this.editresult);
      
      if (this.editresult.length > 1) {
        this.$message.error('只能选择一个数据')
      } else if (this.editresult.length < 1) {
        this.$message.error('至少选择一个数据')
      } else {
        this.editvisiable1 = false
      //   for (let i = 0; i < this.editresult.length; i++) {
      //   const element = {
      //     id:null,
      //     expertId:Number(this.editresult[i].id),
      //     expertise:this.editresult[i].major,
      //     reviewId:this.id,
      //     name:this.editresult[i].name,
      //     workUnit:this.editresult[i].workUnit
      //   }
      // this.selectresult.push(element)

      // }
        // this.selectresult.push(...this.editresult)
      const a = JSON.stringify(this.editresult[0])
      console.log(this.selectresult);
        const element = JSON.parse(a)
        delete element.majorPosition;
        element.expertId = element.id;
        element.id = null
      this.selectresult.splice(this.editindex, 1, element);
      }
      
      },

      saveAdd4(){
      // console.log(this.addresult);
      
      //   if (this.addresult.length < 1) {
      //     this.$message.error('至少选择一个数据')
      //   } else {
      //     this.addresultvisible = false
      //     for (let i = 0; i < this.addresult.length; i++) {
      //       const element = this.addresult[i]
      //       delete element.majorPosition; 
      //       element.expertId = element.id;
      //       this.selectresult.push(element)
      //     }
      //   }

      console.log(this.addForm1);
      if (this.addForm1.drawConditions.length == 0) {
        this.$message.warning("请选择专业");
        return;
      }
      if (this.addForm1.selectedExpertsCount == 0 ||  this.addForm1.selectedExpertsCount == '') {
        this.$message.warning("抽选人数未填写");
        return;
      }
      const a = JSON.stringify(this.addForm1)
      const params = JSON.parse(a)
for (let i = 0; i < params.drawConditions.length; i++) {
  // const element = array[i];
  params.drawConditions[i].expertise1 = params.drawConditions[i].expertise1.join('/')
  params.drawConditions[i].expertise2 = params.drawConditions[i].expertise2.join('/')
  if (params.drawConditions[i].expertise1 == '无') {
    params.drawConditions[i].expertise1  = null
  } else if (params.drawConditions[i].expertise2 == '无') {
    params.drawConditions[i].expertise2  = null
    
  }
  console.log(params.drawConditions[i].expertise1);
  console.log(params.drawConditions[i].expertise2);
  
}
const b = params.drawConditions
      getexpert1(this.id, b)
        .then((res) => {
          console.log(res);
          if (res.code == 200) {
            this.$message.success("获取成功！");
            this.addresultvisible = false
            console.log(res.data);
            // this.repeatid = res.data.expertId
            // this.selectresult = res.data;
            // 直接根据index
            this.selectresult.push(res.data[0]);

            // 匹配expertid
            // for (let i = 0; i < this.selectresult.length; i++) {
            //   console.log(123);
            //   console.log(this.selectresult[i].expertId);
            //   console.log(this.repeatid);
            //   if (this.selectresult[i].expertId == this.repeatid) {
            //     console.log('成功匹配');
            //     // this.selectresult[i] = res.data[0]
            //     this.selectresult.splice(i, 1, res.data[0]);
            //     console.log(this.selectresult);
            //   }
              
            // }
            // console.log(this.);
            this.editvisiable2 = false
          }
        })
        .catch((err) => {
          console.error(err);
        });
      // this.selectresult.push(...this.editresult)
      console.log(this.selectresult);
      // this.selectresult.push(element)

      // }
        // this.selectresult.push(...this.editresult)
      // const a = JSON.stringify(this.editresult[0])
      // console.log(this.selectresult);
      //   const element = JSON.parse(a)
      //   delete element.majorPosition;
      // this.selectresult.splice(this.editindex, 1, element);
      
      
      },
      addresult1() {
        this.addresultvisible = true
      },
      saveAdd3(){
        console.log(this.addForm2);
      if (this.addForm2.drawConditions.length == 0) {
        this.$message.warning("请选择专业");
        return;
      }
      if (this.addForm2.selectedExpertsCount == 0 ||  this.addForm2.selectedExpertsCount == '') {
        this.$message.warning("抽选人数未填写");
        return;
      }
      const a = JSON.stringify(this.addForm2)
      const params = JSON.parse(a)
for (let i = 0; i < params.drawConditions.length; i++) {
  // const element = array[i];
  params.drawConditions[i].expertise1 = params.drawConditions[i].expertise1.join('/')
  params.drawConditions[i].expertise2 = params.drawConditions[i].expertise2.join('/')
  if (params.drawConditions[i].expertise1 == '无') {
    params.drawConditions[i].expertise1  = null
  } else if (params.drawConditions[i].expertise2 == '无') {
    params.drawConditions[i].expertise2  = null
    
  }
  console.log(params.drawConditions[i].expertise1);
  console.log(params.drawConditions[i].expertise2);
  
}
const b = params.drawConditions
      getexpert1(this.id, b)
        .then((res) => {
          console.log(res);
          if (res.code == 200) {
            this.$message.success("获取成功！");
            console.log(res.data);
            // this.repeatid = res.data.expertId
            // this.selectresult = res.data;
            // 直接根据index
            this.selectresult.splice(this.repeatindex, 1, res.data[0]);

            // 匹配expertid
            // for (let i = 0; i < this.selectresult.length; i++) {
            //   console.log(123);
            //   console.log(this.selectresult[i].expertId);
            //   console.log(this.repeatid);
            //   if (this.selectresult[i].expertId == this.repeatid) {
            //     console.log('成功匹配');
            //     // this.selectresult[i] = res.data[0]
            //     this.selectresult.splice(i, 1, res.data[0]);
            //     console.log(this.selectresult);
            //   }
              
            // }
            // console.log(this.);
            this.editvisiable2 = false
          }
        })
        .catch((err) => {
          console.error(err);
        });
      // this.selectresult.push(...this.editresult)
      console.log(this.selectresult);
    },
    savetwo() {
      // const params = {
      //   reviewMeetingVO: this.expertselect,
      //   lotteryResults: this.selectresult,
      // };
      console.log(this.selectresult);
      saveexpert(this.id, this.selectresult)
        .then((res) => {
          console.log(res);
          if (res.code == 200) {
            // this.$message.success("提交成功！");
            // this.activeName = "sthird";
            const a = this.selectresult
  .filter(data => data.name) // 筛选出有name属性的对象
  .map(data => data.name);   // 提取name属性值形成新数组
console.log(a);
this.reviewmessage.expertiseList = a.join(',');
this.reviewmessage.selectedExpertsCount = this.selectresult.length;
this.reviewmessage.isAcademic = this.expertselect.isAcademic;
this.reviewmessage.isDesignMaster = this.expertselect.isDesignMaster;
this.reviewmessage.isSpecial = this.expertselect.isSpecial;
this.reviewmessage.isSubsidy = this.expertselect.isSubsidy;
this.reviewmessage.isLottery = true;

this.reviewmessage.id = this.id
savereview(this.reviewmessage)
        .then((res) => {
          console.log(res);
          if (res.code == 200) {
            this.$message.success("提交成功！");
            // this.activeName = "sthird";
            this.optionchange = [
              {
                label: "全部",
                value: "全部",
              },
            ];
            const a = []
            for (let i = 0; i < this.selectresult.length; i++) {
              console.log(this.selectresult[i].expertise);
              a.push(...this.selectresult[i].expertise.split(','))
              // b.push(this.selectresult[i].name)
            }
            console.log(a);
            const uniqueA = [...new Set(a)];
            for (let i = 0; i < uniqueA.length; i++) {
              const element = {
                label: uniqueA[i],
                value: uniqueA[i],
              };
              console.log(456);
              this.optionchange.push(element);
            }
          }
        })
        .catch((err) => {
          console.error(err);
        });
          }
        })
        .catch((err) => {
          console.error(err);
        });
    },
    saveone() {
      // console.log(this.reviewmessage);
      savereview(this.reviewmessage)
        .then((res) => {
          console.log(res);
          if (res.code == 200) {
            this.$message.success("新增成功！");
            this.id = res.data;
            this.activeName = "ssecond";
          }
        })
        .catch((err) => {
          console.error(err);
        });
    },
    getnumber() {
      console.log(this.expertselect.selectedExpertsCount);
      this.expertselect.drawConditions = []
      for (let i = 0; i < this.expertselect.selectedExpertsCount; i++) {
        const element = {
          expertise1: '',
          expertise2:['无'],
        }
        this.expertselect.drawConditions.push(element)
      }
    },
    savethree() {
      console.log(this.reviewmessage);
      this.reviewmessage.id = this.id
      savereview(this.reviewmessage)
        .then((res) => {
          console.log(res);
          if (res.code == 200) {
            this.$message.success("保存成功！");
          }
        })
        .catch((err) => {
          console.error(err);
        });
    },
    editExpert(val,index) {
      console.log(val);
      this.editindex = index
      this.currentresult = val
      this.editvisiable1 = true;
    },
    delExpert(id,index) {
      this.repeatid = id
      this.repeatindex = index
      this.editvisiable2  = true
      // console.log(val);
      // this.selectresult = this.selectresult.filter((data) => {
      //   return data.expertId != val;
      // });
    },
    selectall() {
      const collectAllValues = (optionchange) => {
        let values = [];
        optionchange.forEach((item) => {
          values.push(item.value);

          // if (item.children && item.children.length > 0) {
          //   // 有子节点，递归处理子节点
          //   values = values.concat(collectAllValues(item.children));
          // } else {
          //   // 叶子节点，收集 value
          //   values.push(item.value);
          // }
        });
        return values;
      };
      // 调用收集方法，拿到所有可选项的 value
      const allValues = collectAllValues(this.optionchange);
      // 将所有值赋给绑定的 selectedValues，实现全选
      this.addForm.expertises = allValues;
    },
    // savethree(){

    // },
    saveAdd() {
      // this.tabledata.push(this.addForm);
      console.log(this.addForm);
      // for (let i = 0; i < this.addForm.expertises.length; i++) {
      //   this.addForm.expertises[i] =
      //     this.addForm.expertises[i].join("/");
      // }
      // for (let i = 0; i < this.addForm.expertises.length; i++) {
      //     if (this.addForm.expertises[i] == '全部') {
      //       this.addForm.expertises = this.expertselect.expertiseList
      //       // return
      //     }
      // }
      this.addForm.reviewId = this.id;
      this.addForm.id = null;
      addchangeexpert(this.id, this.addForm).then((res) => {
        console.log(res);
        if (res.code == 200) {
          this.$message.success("变更成功！");
          this.reviewmessage.changeCount =
            Number(this.reviewmessage.changeCount) + 1;
          this.addvisiable = false;
          const a = JSON.stringify(this.addForm);
          const b = JSON.parse(a);
          b.id = res.data;
          this.tabledata.push(b);
          console.log(this.tabledata);
        }
      });
    },
    toggleSelection(rows) {
      if (rows) {
        rows.forEach((row) => {
          this.$refs.multipleTable.toggleRowSelection(row);
        });
      } else {
        this.$refs.multipleTable.clearSelection();
      }
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    next() {
      if (this.activeName == "sfirst") {
        this.activeName = "ssecond";
      } else if (this.activeName == "ssecond") {
        this.activeName = "sthird";
      }
    },
    addrow() {
      this.addvisiable = true;
    },
    beforup() {
      return true;
    },
    resetchangeresult(){
      this.addForm3={ name: "", major:[] }
    },
      searchchangeresult() {
        console.log(123465);
      console.log(this.addForm3);
      this.addForm3.major = this.addForm3.major.join('/')
      // const a = {
      console.log(this.addForm3);
        console.log(this.id);
        searchbynamemarjor(this.id,this.addForm3).then((res)=>{
          console.log(res);
          this.selectresult1 = res
        })
      // }
    },
    handleSelectionChange1(val){
      // console.log(val);
      this.editresult = val
    },

    handleSelectionChange2(val){
      console.log(val);
      this.addresult = val
    },
    loadAll() {
      return [
        { value: "三全鲜食（北新泾店）", address: "长宁区新渔路144号" },
        {
          value: "Hot honey 首尔炸鸡（仙霞路）",
          address: "上海市长宁区淞虹路661号",
        },
        {
          value: "新旺角茶餐厅",
          address: "上海市普陀区真北路988号创邑金沙谷6号楼113",
        },
        { value: "泷千家(天山西路店)", address: "天山西路438号" },
        {
          value: "胖仙女纸杯蛋糕（上海凌空店）",
          address: "上海市长宁区金钟路968号1幢18号楼一层商铺18-101",
        },
        { value: "贡茶", address: "上海市长宁区金钟路633号" },
        {
          value: "豪大大香鸡排超级奶爸",
          address: "上海市嘉定区曹安公路曹安路1685号",
        },
        {
          value: "茶芝兰（奶茶，手抓饼）",
          address: "上海市普陀区同普路1435号",
        },
        { value: "十二泷町", address: "上海市北翟路1444弄81号B幢-107" },
        { value: "星移浓缩咖啡", address: "上海市嘉定区新郁路817号" },
        { value: "阿姨奶茶/豪大大", address: "嘉定区曹安路1611号" },
        { value: "新麦甜四季甜品炸鸡", address: "嘉定区曹安公路2383弄55号" },
        {
          value: "Monica摩托主题咖啡店",
          address: "嘉定区江桥镇曹安公路2409号1F，2383弄62号1F",
        },
        {
          value: "浮生若茶（凌空soho店）",
          address: "上海长宁区金钟路968号9号楼地下一层",
        },
        { value: "NONO JUICE  鲜榨果汁", address: "上海市长宁区天山西路119号" },
        { value: "CoCo都可(北新泾店）", address: "上海市长宁区仙霞西路" },
        {
          value: "快乐柠檬（神州智慧店）",
          address: "上海市长宁区天山西路567号1层R117号店铺",
        },
        {
          value: "Merci Paul cafe",
          address: "上海市普陀区光复西路丹巴路28弄6号楼819",
        },
        {
          value: "猫山王（西郊百联店）",
          address: "上海市长宁区仙霞西路88号第一层G05-F01-1-306",
        },
        { value: "枪会山", address: "上海市普陀区棕榈路" },
        { value: "纵食", address: "元丰天山花园(东门) 双流路267号" },
        { value: "钱记", address: "上海市长宁区天山西路" },
        { value: "壹杯加", address: "上海市长宁区通协路" },
        {
          value: "唦哇嘀咖",
          address: "上海市长宁区新泾镇金钟路999号2幢（B幢）第01层第1-02A单元",
        },
        { value: "爱茜茜里(西郊百联)", address: "长宁区仙霞西路88号1305室" },
        {
          value: "爱茜茜里(近铁广场)",
          address:
            "上海市普陀区真北路818号近铁城市广场北区地下二楼N-B2-O2-C商铺",
        },
        {
          value: "鲜果榨汁（金沙江路和美广店）",
          address: "普陀区金沙江路2239号金沙和美广场B1-10-6",
        },
        {
          value: "开心丽果（缤谷店）",
          address: "上海市长宁区威宁路天山路341号",
        },
        { value: "超级鸡车（丰庄路店）", address: "上海市嘉定区丰庄路240号" },
        { value: "妙生活果园（北新泾店）", address: "长宁区新渔路144号" },
        { value: "香宜度麻辣香锅", address: "长宁区淞虹路148号" },
        {
          value: "凡仔汉堡（老真北路店）",
          address: "上海市普陀区老真北路160号",
        },
        { value: "港式小铺", address: "上海市长宁区金钟路968号15楼15-105室" },
        { value: "蜀香源麻辣香锅（剑河路店）", address: "剑河路443-1" },
        { value: "北京饺子馆", address: "长宁区北新泾街道天山西路490-1号" },
        {
          value: "饭典*新简餐（凌空SOHO店）",
          address: "上海市长宁区金钟路968号9号楼地下一层9-83室",
        },
        {
          value: "焦耳·川式快餐（金钟路店）",
          address: "上海市金钟路633号地下一层甲部",
        },
        { value: "动力鸡车", address: "长宁区仙霞西路299弄3号101B" },
        { value: "浏阳蒸菜", address: "天山西路430号" },
        { value: "四海游龙（天山西路店）", address: "上海市长宁区天山西路" },
        {
          value: "樱花食堂（凌空店）",
          address: "上海市长宁区金钟路968号15楼15-105室",
        },
        { value: "壹分米客家传统调制米粉(天山店)", address: "天山西路428号" },
        {
          value: "福荣祥烧腊（平溪路店）",
          address: "上海市长宁区协和路福泉路255弄57-73号",
        },
        {
          value: "速记黄焖鸡米饭",
          address: "上海市长宁区北新泾街道金钟路180号1层01号摊位",
        },
        { value: "红辣椒麻辣烫", address: "上海市长宁区天山西路492号" },
        {
          value: "(小杨生煎)西郊百联餐厅",
          address: "长宁区仙霞西路88号百联2楼",
        },
        { value: "阳阳麻辣烫", address: "天山西路389号" },
        {
          value: "南拳妈妈龙虾盖浇饭",
          address: "普陀区金沙江路1699号鑫乐惠美食广场A13",
        },
      ];
    },
    querySearchAsync(queryString, cb) {
      var restaurants = this.restaurants;
      var results = queryString
        ? restaurants.filter(this.createStateFilter(queryString))
        : restaurants;

      clearTimeout(this.timeout);
      this.timeout = setTimeout(() => {
        cb(results);
      }, 3000 * Math.random());
    },
    createStateFilter(queryString) {
      return (state) => {
        return (
          state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
        );
      };
    },
    handleSelect(item) {
      console.log(item);
    },
    handletableClick(row) {
      this.editvisible = true;
      const a = JSON.parse(JSON.stringify(row));
      console.log(a);
      if (a.exploreTime == "xx年xx月xx日") {
        a.exploreTime = "";
      }
      this.editlist = JSON.parse(JSON.stringify(a));
    },
    deleteExpert(id) {
      // console.log(id);
      deleteexpertchange(id).then((res) => {
        console.log(res);
        if (res.code == 200) {
          this.$message.success("删除成功！");
          console.log(this.tabledata);
          this.tabledata= this.tabledata.filter((item) => item.id != id);
          this.reviewmessage.changeCount = Number(this.reviewmessage.changeCount) - 1
          // this.tableData.splice(index, 1);

          // if (index !== -1) {
          //   this.tableData.splice(index, 1);
          //   this.$message.success("删除成功");
          // }
        }
      });
    },
    handledelete(row) {
      // console.log(row.id);
      // this.tableData.filter((data)=>{
      //   return data.id != row.id
      // })
      const index = this.tableData.findIndex((item) => item.id === row.id);
      if (index !== -1) {
        this.tableData.splice(index, 1);
        this.$message.success("删除成功");
      }
    },
    formatDateback(params) {
      const [year, month, day] = params.split(/年|月|日/).filter(Boolean);
      const a = new Date(
        parseInt(year, 10),
        parseInt(month, 10) - 1, // 月份从0开始（0=一月）
        parseInt(day, 10)
      );
      return a;
    },
    formatDate(date) {
      const year = date.getFullYear();
      const month = date.getMonth() + 1;
      const day = date.getDate();
      // const a = `${year}年${month}月${day}日`
      const a = year + "年" + month + "月" + day + "日";
      return a;
    },
  },
};
</script>
  <style scoped>
::v-deep .el-tabs__item {
  height: 60px;
  line-height: 60px;
  background-color: #f5f7fa;
  font-size: 0.9vw;
}

::v-deep .el-tabs__nav-scroll {
  background-color: #f5f7fa;
}
::v-deep .el-form-item__label {
  font-size: 0.85vw;
}
::v-deep .el-tabs__item.is-active {
  color: #f5f7fa;
  background-color: #374b6a;
}

.el-tabs {
  height: 100%;
  background-color: #ffffff;
}

.input {
  display: flex;
}

.ltitle {
  text-align: left;
  /* margin-top: 10px;
    margin-left: 10px; */
  margin: 10px;
  font-size: 16px;
  font-weight: bold;
  letter-spacing: 5px;
}

.uploadtfund .el-upload-list {
  max-height: 60px;
  /* 设置文件列表容器的最大高度 */
  overflow-y: auto;
  /* 设置溢出内容的滚动条 */
}

.el-divider {
  margin: 10px;
}

.paperDialog .el-row {
  margin-bottom: 1px;
}

.paperDialog .el-form-item__label {
  background-color: rgb(129, 24, 24);
}
::v-deep .el-tabs__nav-scroll {
  background-color: #f5f7fa;
}
::v-deep .el-tabs__item.is-active {
  font-weight: bold;
  color: #0195dd;
  background-color: #fff;
}

.newTablev2 .el-tabs__nav-scroll {
  background-color: #0195dd;
}
.newTablev2 .el-tabs--card > .el-tabs__header .el-tabs__item {
  border-left: none;
}
.newTablev2 .el-tabs__item {
  height: 70px;
  color: #686e80;
  height: 70px;
  line-height: 70px;
  font-size: 1vw;
  background-color: #ffffff;
}

.newTablev2 .el-tabs__item.is-active {
  font-weight: bold;
  color: #0195dd;
  background-color: #fff;
}
.newTablev2 .el-tabs {
  height: auto;
  min-height: 83vh;
  background-color: #f8f7f7 !important;
}
.el-formsmall {
  margin-left: 10px;
  margin-right: 30px;
  height: 100%;
  margin-top: 5px;
  background-color: #f8f7f7;
}

::v-deep .el-checkbox__label{
  font-size: 0.9vw;
}
</style>